﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace FrameWork.web.Web.Project.SelPage
{
    public partial class UploadFileForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Response.ContentType = "text/plain";
                Response.Charset = "utf-8";
                string strUploadPath = Request.PhysicalApplicationPath + Request.QueryString["folder"].Trim('/').Replace("/", "\\") + "\\";
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFile postedFile = Request.Files[i];
                    string fileName = strUploadPath + Path.GetFileName(postedFile.FileName);
                    if (fileName != "")
                    {
                        postedFile.SaveAs(fileName);
                    }
                }
                Response.Write("Upload The File Successfully!");
            }
            catch (Exception ex)
            {
                Response.ContentType = "text/plain";
                Response.Write(ex.Message);
            }
            finally
            {
                Response.Flush();
                Response.End();
            }

        }
    }
}